/**
 * @Author：ming
 * @Date：2023/10/5 7:55 PM
 * @Filename：Lc
 */

import java.util.List;

/**
 * @author ming
 */
public class Lc139 {
    public boolean wordBreak(String s, List<String> wordDict) {
        int len = s.length();
        boolean[] dp = new boolean[len + 1];
        dp[0]=true;
        for (int i = 1; i <= len ; i++) {
            for (int j = 0; j < i; j++) {
                if(wordDict.contains(s.substring(j,i))&dp[j]){
                    dp[i]=true;
                    break;

                }
            }

        }
        return dp[len];
    }
}
